using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Dao;
using Entities;
namespace Doctors_WebForum.Admin.UIControls
{
    public partial class FeedbacksDetails : System.Web.UI.UserControl
    {
        private FeedbackData feedBackData;
        private Feedback feedback;
        public FeedbacksDetails()
        {
            feedBackData = new FeedbackData();
            feedback = new Feedback();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["ID"];
            if (id != null)
            {
                feedback = feedBackData.GetFeedbackByID(Utility.ToInt(id));
                txtFeedID.Text = feedback.FeedBackID.ToString();
                txtFullName.Text = feedback.FullName;
                txtEmail.Text = feedback.Email;
                txtTitle.Text = feedback.Tilte;
                txtContent.Text = feedback.Content;
                txtSendDate.Text = feedback.SendDate.ToShortDateString();
            }
        }
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Write("<script>window.close()</script>");
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string id = txtFeedID.Text;
            if (id != null)
            {
                if (feedBackData.DeleteById(Utility.ToInt(id)) == true)
                {
                    lblMessage.Text = "<font style='color:red'>Delete suscess !</font>";
                    txtFeedID.Text = "";
                    txtFullName.Text = "";
                    txtEmail.Text = "";
                    txtTitle.Text = "";
                    txtContent.Text = "";
                    txtSendDate.Text = "";
                }
                else
                    lblMessage.Text = "<font style='color:red'>Delete not suscess !</font>";
            }
        }
    }
}